import { request } from "@/utils/request";

//获取问题合集
export function getQuestionList() {
    return request({
        methods: 'post',
        url: 'question/getQuestionList',
        headers: {
            'token': window.localStorage.token,
        },
    })
}

//根据问题id获取问题对象
export function getQuestionById(id) {

    //将id拼接到url上面
    const encodedId = encodeURIComponent(id);
    const url = `question/getQuestionById?id=${encodedId}`;

    return request({
        method: 'post',
        url: url,
        headers: {
            'token': window.localStorage.token,
        }
    })
}
//根据问题id获取回复合集
export function getAnswerListById(id) {

    //将id拼接到url上面
    const encodedId = encodeURIComponent(id);
    const url = `question/getAnswerListById?id=${encodedId}`;

    return request({
        method: 'post',
        url: url,
        headers: {
            'token': window.localStorage.token,
        }
    })
}